package cn.icanci.learn.v1.aop2;

import cn.icanci.learn.v1.aop.Animal;
import cn.icanci.learn.v1.aop.Cat;
import cn.icanci.learn.v1.aop.JDKDynamicProxy;

/**
 * 多层代理
 * @author icanci
 * @date Created in 2021/06/27 17:08
 * @version 1.0
 */
public class AnimalMainTest2 {
    public static void main(String[] args) {
        Animal cat = new Cat();
        JDKDynamicProxy jdkDynamicProxy = new JDKDynamicProxy(cat);

        Animal animal = (Animal) jdkDynamicProxy.getProxy();

        JDKDynamicProxy2 jdkDynamicProxy2 = new JDKDynamicProxy2(animal);

        Animal animal1 = (Animal) jdkDynamicProxy2.getProxy();

        cat.eat();
        System.out.println("---------------------------------");
        animal.eat();
        System.out.println("---------------------------------");
        animal1.eat();
        //        ProxyUtils.generateClassFile(animal.getClass(), animal.getClass().getName());
    }
}
